<template>
  <div id="app">
    <header>
      <router-view name="header" />
    </header>
    <main>
      <!-- <router-view /> -->
      <router-view v-if="!isKeepAlive" />
      <keep-alive>
        <router-view v-if="isKeepAlive" />
      </keep-alive>
    </main>
    <footer>
      <router-view name="footer" />
    </footer>
  </div>
</template>

<script>

export default {
  name: 'App',
  computed: {
    isKeepAlive () {
      return this.$route.path.split('/').includes('category')
    }
  }
}
</script>

<style lang="less">
  * {
    margin: 0;
    padding: 0;
  }
  html, body {
    height: 100%;
  }
  #app {
    display: flex;
    flex-direction: column;
    height: 100%;

    main {
      flex: 1;
      overflow-x: hidden;
    }
  }
</style>
